package com.ccl.myblog;

import lombok.Value;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

import java.net.InetAddress;
import java.net.UnknownHostException;

@Slf4j
@SpringBootApplication
@EnableScheduling
@EnableTransactionManagement
@EnableWebMvc
public class MyblogApplication {

    public static void main(String[] args) {
        ConfigurableApplicationContext context = SpringApplication.run(MyblogApplication.class, args);
        Environment environment = context.getBean(Environment.class);
        try {
            log.info("系统访问路径：http://" + InetAddress.getLocalHost().getHostAddress() +":"+ environment.getProperty("server.port"));
            log.info("Swagger访问路径：http://" + InetAddress.getLocalHost().getHostAddress() +":"+ environment.getProperty("server.port") + "/swagger-ui.html");
        } catch (UnknownHostException e) {
            e.printStackTrace();
        }
    }

}
